<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
<title>我的银行卡</title>
<link href="Style/Common.css" rel="stylesheet">
<link href="Style/User.css" rel="stylesheet">
<script src="Js/jquery.min.js" type="text/javascript"></script>
<script src="Js/Banner.js" type="text/javascript"></script>
</head>

<body>
 <div class="Header">  
  <p>我的银行卡</p>
  <span onclick="location.href = 'MyMoney.html';"><img src="Images/Return.png"></span>
  <a href="BindingCard.html">添加银行卡</a>
 </div><!--Header end--> 
 <ul class="MyCardBox">
  <!-- js 动态插入卡信息 -->
 </ul><!--MyCardBox end-->
 
 <div class="MenuBar" id="menuDiv">
 </div><!--MenuBar end--> 
</body>
<script src="Js/common.js" type="text/javascript"></script>
<script src="Js/user.js" type="text/javascript"></script>
<script type="text/javascript">
  window.onload = showCard;
  function showCard() {
      var dataInfo2;
      var html_string = "";
      var image = "";
      $.ajax({
          type: "post",
          url: "/ServiceInterface/MyBankAndMoney.ashx",
          data: { flag: "listbank" },
          dataType: "text",
          async: false,
          success: function (data) {
              //alert(data);
              dataInfo2 = data;
          }
      });
      // dataInfo = [{"Sysnumber":"f3e27969-6e1b-425a-b8ec-1ebf9da1611a","BankName":"中国建设银行","CardNumber":"1111111111111111111111"},{"Sysnumber":"75727969-6e1b-425a-b8ec-1ebf9da1611a","BankName":"中国农业银行","CardNumber":"22222222222222222222222"},{"Sysnumber":"f3e27969-6e1b-425a-b8ec-1ebf9da1611a","BankName":"中国工商银行","CardNumber":"3333333333333333333333"},{"Sysnumber":"75727969-6e1b-425a-b8ec-1ebf9da1611a","BankName":"中国银行","CardNumber":"4444444444444444444444"}]
      dataInfo = eval(dataInfo2);
      for (var i = 0; i < dataInfo.length; i++) {
          switch (dataInfo[i].BankName) {
              case "工商银行": image = "Images/ICBC.png"; break;
              case "建设银行": image = "Images/CCb.png"; break;
              case "中国银行": image = "Images/Cb.png"; break;
              case "农业银行": image = "Images/ABC.png"; break;
          }
          html_string += '<li>' +
          '<div class="CardImg"><img src="' + image + '"></div>' +
          '<p class="CardCla Sizing"><b>' + dataInfo[i].BankName + '</b><span>储蓄卡</span></p>' +
          '<p class="CardNum"><span style="cursor:pointer">解除绑定</span><b>' + dataInfo[i].CardNumber + '</b></p>' +
        '</li>'
      }
      $(".MyCardBox").html(html_string);
  }

  $(document).on('click', ".CardNum span", function () {
      if (confirm('确定要解除绑定吗？') == false) { return; }
      var CardNum = $(this).parent().children("b").html();
      $.ajax({
          type: "post",
          url: "/ServiceInterface/MyBankAndMoney.ashx",
          data: { flag: "delbank", CardNumber: CardNum },
          dataType: "text",
          async: false,
          success: function (data) {
              if (data == '1') {
                  alert('解除成功');
                  location.href = "MyCard.html"
              } else {
                  alert(data);
              }
          }
      });
  });

</script>
</html>
